import unittest
import ddt
import time

from Base.BaseSetings import *

from Business.HumanMangement_Sun import WoniuBoss

from Business.all import WoniuBoss


@ddt.ddt
class Us(unittest.TestCase):
    def setUp(self) -> None:

        self.dr = WoniuBoss()

    # def test_student_0001(self):  # 修改用户描述
    #     """修改用户成功"""
    #     author = '彭振宇'
    #     casemodule = '学生管理'
    #     result = self.dr.alterrole()
    #
    #     self.assertEqual(result, '我是班主任')
    #
    # @ddt.file_data(TestData_dir + "search_user.yaml")
    # def test_student(self, **kwargs):  # 用户管理  用户查询
    #     """用户查询成功"""
    #     author = '彭振宇'
    #     casemodule = '学生管理'
    #     result = self.dr.search_user()
    #     self.assertEqual(result, kwargs.get('assert_info'))
#-------------------------------------------------------------------------------------彭振宇
#
    @ddt.file_data(TestData_dir + 'human_mangement.yaml')
    def test_mangement(self, **kwargs):
        """新增员工成功"""
        author = '孙冉1'
        casemodule = '人事管理'

        info = self.dr.human_mangement_creatstaff(kwargs)
        self.assertEqual(info[0][0],kwargs.get('assert_name'), '添加成功')
        self.assertEqual(info[1][0],kwargs.get('assert_name'), '添加成功')

    def test_mangement_0003(self):
        """用户张莉查询成功"""
        author = '孙冉1'
        casemodule = '人事管理'
        info = self.dr.human_mangement_querystaff('全部', '全部', '全部', '张莉')
        self.assertEqual(info[0][0], '张莉', '查询成功')
# # #---------------------------------------------------------------------------------------孙冉
#
    # @ddt.file_data(TestData_dir +'teaching_management.yaml')
    # def test_case_add_apply(self,**kwargs):
    #     author = '陈雪'
    #     casemodule = '教务管理'
    #     time.sleep(2)
    #     id,table2,selectText = self.dr.add_apply(kwargs.get('flag'))
    #     self.assertEqual(int(id)+1,int(table2[0][0]))
    #     for selected in selectText:
    #        self.assertEqual(selectText,table2[0][2])

#
#
#     def test_case_apply_reason(self):
#         author = '陈雪'
#         casemodule = '教务管理'
#         res = self.dr.apply_reason()
#         self.assertEqual(res,'加班原因少于10字不能提交')
#
#
#     def test_case_assign_work(self):
#         author = '陈雪'
#         casemodule = '教务管理'
#         tableInfo,selectedText = self.dr.assign_work()
#         self.assertEqual(selectedText,tableInfo[0][1])
#
#
#     def test_case_sys_employee_query(self):
#         author = '陈雪'
#         casemodule = '教务管理'
#         res = self.dr.sys_employee_query()
#         self.assertEqual(res, eval("[['无符合条件的记录']]"))
# #------------------------------------------------------------------------------------陈雪
#
#     @ddt.file_data(TestData_dir + "add_company.yaml")
#     def test_case_002(self, **kwargs):
#         '''就业管理——查看新增企业是否成功'''
#         author = '舒慧玲'
#         casemodule = '就业管理'
#
#         result = self.dr.add_company(kwargs.get("company"), kwargs.get("industry"), kwargs.get("address"),
#                                      kwargs.get("name"), kwargs.get("phone"))
#
#         self.assertIn(kwargs.get("expect"), result[0])
#
#
#     def test_case_003(self):
#         '''就业管理——查看搜索就业信息是否正确'''
#         author = '舒慧玲'
#         casemodule = '就业管理'
#
#         result = self.dr.search_company("成都", "全部", "公共")
#
#         for i in result:
#
#             self.assertEqual(i[3], "公共")
#
#     #
#     def test_case_004(self):
#         '''就业管理——新增就业信息是否成功'''
#         author = '舒慧玲'
#         casemodule = '就业管理'
#         result = self.dr.add_join_company("成都", "全部", "全部", "测试工程师", "15000", "阿里巴巴")
#
#         for i in result:
#             a = (i[-1].split("\n")[-1])
#             self.assertEqual(a, "提交新增")
#
#     def test_case_005(self):
#         '''就业管理——查询企业客户是否正确'''
#         author = '舒慧玲'
#         casemodule = '就业管理'
#         result = self.dr.search_company_client("阿里巴巴")
#
#         self.assertEqual(result[0][0], "阿里巴巴")
#
#     #
#     def test_case_006(self):
#         '''就业管理——修改企业客户是否成功'''
#         author = '舒慧玲'
#         casemodule = '就业管理'
#         result = self.dr.modification("阿里巴巴", "李小姐")
#
#         self.assertEqual(result[0][2], "李小姐")
# #------------------------------------------------------------------------------舒慧玲
#     #
#     @ddt.file_data(TestData_dir + "stu_leave_select_wxj.yaml")
#     def test_stu_leave_select(self, **kwargs):  # 学员请假信息查询===
#         '''查询学员信息，查看返回结果是否符合预期'''
#         author = '吴小静'
#         casemodule = '班务管理'
#
#         info = self.dr.stu_leave_select(kwargs.get('region'), kwargs.get('status_leave'), kwargs.get('leave_stu_name'))
#
#         self.assertEqual(info[0][0], kwargs.get('leave_stu_name'))
#         self.assertEqual(info[0][9], kwargs.get('status_leave'))
#
#     @ddt.file_data(TestData_dir + "stu_change_wxj.yaml")
#     def test_stu_change(self, **kwargs):  # 学员转班===
#         '''指定学员转班，查看返回结果是否符合预期'''
#         author = '吴小静'
#         casemodule = '班务管理'
#
#         info = self.dr.stu_change(kwargs.get('school_region'), kwargs.get('change_cls'))
#
#         self.assertEqual(info, kwargs.get('except'))
#
#
#     @ddt.file_data(TestData_dir + "stu_change_wxj.yaml")
#     def test_stu_change_query(self, **kwargs):  # 学员转班信息查询===
#         '''根据条件查询学院转班信息'''
#         author = '吴小静'
#         casemodule = '班务管理'
#         infos = self.dr.stu_change_query(kwargs.get('school_region'), kwargs.get('change_cls'))
#         for info in infos:
#
#             if info != ['无符合条件的记录']:
#                 self.assertEqual(info[3], kwargs.get('change_cls'))
#
#
#     @ddt.file_data(TestData_dir + "cls_manage_wxj.yaml")
#     def test_cls_manage(self, **kwargs):  # 新增班级
#         '''新增开班的新班级'''
#         author = '吴小静'
#         casemodule = '班务管理'
#         res = self.dr.cls_manage(kwargs.get('cls_num'), kwargs.get('direction'), kwargs.get('teacher'))
#
#         self.assertEqual(res, kwargs.get('except'))


#------------------------------------------------------------------------------------吴小静
if __name__ == '__main__':
    unittest.main()